package com.vishnu.jb;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.validator.ValidatorActionForm;

public class UserRegistrationFormFB extends ValidatorActionForm{

	private String password;
	private String retypePassword;
	private String userName;
	private String age;
	private String dob;
	private String emailId;
	
	
	
	public String getUserName() {
		return userName;
	}


	public void setUserName(String userName) {
		this.userName = userName;
	}



	public String getDob() {
		return dob;
	}
	


	public String getAge() {
		return age;
	}


	public void setAge(String age) {
		this.age = age;
	}


	public void setDob(String dob) {
		this.dob = dob;
	}




	public String getEmailId() {
		return emailId;
	}


	public void setEmailId(String emailId) {
		this.emailId = emailId;
	}


	public String getPassword() {
		return password;
	}


	public void setPassword(String password) {
		this.password = password;
	}


	public String getRetypePassword() {
		return retypePassword;
	}


	public void setRetypePassword(String retypePassword) {
		this.retypePassword = retypePassword;
	}


	public ActionErrors validate(ActionMapping mapping,HttpServletRequest request){
		System.out.println("validate method ...............");
		ActionErrors aes=new ActionErrors();
		String password=getPassword();
		String retypePassword=getRetypePassword();
		
		if(!password.equals(retypePassword)){
			aes.add("mismatch",new ActionMessage("Password.Mismatch"));
		}
		
		aes.add(super.validate(mapping, request));
		System.out.println("Errors after ="+request.getAttribute("org.apache.struts.action.ERROR"));
		System.out.println("validate method--------over..");
		return aes;
	}
	
}
